# Contributor: Celeste <cielesti@protonmail.com>
# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=emacs-hnreader
pkgver=0_git20221116
_gitrev=8444e177035e236e991f9ea73074c053a45426ad
pkgrel=0
_pkgreal=hnreader
pkgdesc="Read Hacker News in Org-mode"
url="https://github.com/thanhvg/emacs-hnreader"
arch="noarch"
license="GPL-3.0-or-later"
depends="
	cmd:emacs
	emacs-promise
	emacs-request
	"
makedepends="emacs-nox"
checkdepends="
	emacs-ert-async
	emacs-f
	"
source="https://github.com/thanhvg/emacs-hnreader/archive/$_gitrev/emacs-hnreader-$_gitrev.tar.gz"
builddir="$srcdir/$pkgname-$_gitrev"

build() {
	emacs -batch -q -no-site-file -L . \
		-f batch-byte-compile \
		./*.el
}

check() {
	emacs -batch -q -no-site-file -L . -L test \
		-l test-helper -l emacs-hnreader-test \
		-f ert-run-tests-batch-and-exit
}

package() {
	install -Dvm644 ./*.el ./*.elc \
		-t "$pkgdir"/usr/share/emacs/site-lisp/

	cd "$pkgdir"/usr/share/emacs/site-lisp
	emacs -batch -q -no-site-file \
		-eval "(loaddefs-generate \".\" \"$_pkgreal-loaddefs.el\")"
}

sha512sums="
da37a70159ca44ee067dbbf15e068e556f56f693e74826e8b452ea1c177d2c164995a9a499e7b736006d62795b890d68a09a72cf4231e784dda575221b11278f  emacs-hnreader-8444e177035e236e991f9ea73074c053a45426ad.tar.gz
"
